from boot import QWidget, Qt, Union
from view.com_0.list_frame_base import SearchListFrameBase
from view.com_0.search_list_base import SearchListBase
from view.widget.qq9_list_widget import QQ9ListWidget


__all__ = ["BillListFrame"]


class BillListFrame(SearchListFrameBase):

    def __init__(self, parent: Union[QWidget, None] = None):
        super().__init__(parent=parent)

        # 搜索框
        self.search_list_frame = SearchListFrame()
        self.main_v_layout.addWidget(self.search_list_frame)

        # 列表框
        self.list_widget = QQ9ListWidget(
            g_list_widget_name="bill_list_widget",
            g_current_selected_id_name="bill_selected_id"
        )
        self.main_v_layout.addWidget(self.list_widget)


class SearchListFrame(SearchListBase):

    def __init__(self, parent: Union[QWidget, None] = None):
        super().__init__(parent=parent)

        # 搜索框加入布局
        self.search_line_edit.setFixedWidth(140)
        self.main_h_layout.addWidget(self.search_line_edit, alignment=Qt.AlignVCenter)

        # 新建按钮加入布局
        self.main_h_layout.addWidget(self.add_button, alignment=Qt.AlignVCenter)

        # 筛选按钮加入布局
        self.main_h_layout.addWidget(self.filter_button, alignment=Qt.AlignVCenter)

        # 刷新按钮加入布局
        self.main_h_layout.addWidget(self.refresh_button, alignment=Qt.AlignVCenter)

        # 截屏按钮加入布局
        self.main_h_layout.addWidget(self.screenshot_button, alignment=Qt.AlignVCenter)
